package org.lalib.controller.form;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.SessionScoped;

import org.lalib.acquire.IControllerForm;
import org.lalib.entity.object.ECategory;
import org.lalib.entity.object.ETable;
import org.springframework.stereotype.Controller;

@SessionScoped
@Controller("cTableCategoryForm")
public class CTableCategoryForm implements IControllerForm {

	private static final long serialVersionUID = 1L;
	private ETable table;
	private List<CategoryBean> userCategories = new ArrayList<>();
	private List<CategoryBean> excludedCategories = new ArrayList<>();

	private List<ECategory> userBaseCategories = new ArrayList<>();
	private List<ECategory> excludedBaseCategories = new ArrayList<>();

	public List<CategoryBean> getUserCategories() {
		return userCategories;
	}

	public void setUserCategories(List<CategoryBean> userCategories) {
		this.userCategories = userCategories;
	}

	public List<CategoryBean> getExcludedCategories() {
		return excludedCategories;
	}

	public void setExcludedCategories(List<CategoryBean> excludedCategories) {
		this.excludedCategories = excludedCategories;
	}

	public List<ECategory> getUserBaseCategories() {
		return userBaseCategories;
	}

	public void setUserBaseCategories(List<ECategory> userBaseCategories) {
		this.userBaseCategories = userBaseCategories;
	}

	public List<ECategory> getExcludedBaseCategories() {
		return excludedBaseCategories;
	}

	public void setExcludedBaseCategories(List<ECategory> excludedBaseCategories) {
		this.excludedBaseCategories = excludedBaseCategories;
	}

	public ETable getTable() {
		return table;
	}

	public void setTable(ETable table) {
		this.table = table;
	}

	public class CategoryBean {

		private boolean selected = false;
		private ECategory category;

		public CategoryBean() {
		}

		public CategoryBean(ECategory eCategory) {
			setCategory(eCategory);
		}

		public CategoryBean(ECategory eCategory, boolean selected) {
			setCategory(eCategory);
			setSelected(selected);
		}

		public boolean isSelected() {
			return selected;
		}

		public void setSelected(boolean selected) {
			this.selected = selected;
		}

		public ECategory getCategory() {
			return category;
		}

		public void setCategory(ECategory category) {
			this.category = category;
		}
	}

}
